package windbell.domain.risk;

import edu.fudan.langlab.domain.task.TSKRoutineProtocal;
import edu.fudan.langlab.domain.task.TSKRoutineTaskGenerator;
import edu.fudan.mylang.pf.EntityAdaptor;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import windbell.domain.risk.IHaveCheckTargets;
import windbell.domain.risk.RiskCheckGenerator;
import windbell.domain.risk.RiskCheckTarget;
import windbell.domain.risk.proxy.TSKRoutineProtocalToCCHospitalAdaptorProxy;

public class TSKRoutineProtocalToCCHospitalAdaptor extends EntityAdaptor<TSKRoutineProtocal> implements IHaveCheckTargets {
  public TSKRoutineProtocalToCCHospitalAdaptor() {
    super();
  }
  
  public TSKRoutineProtocalToCCHospitalAdaptor(final TSKRoutineProtocal adaptee) {
    this.adaptee = adaptee;
  }
  
  public TSKRoutineProtocalToCCHospitalAdaptorProxy toProxy() {
    return new TSKRoutineProtocalToCCHospitalAdaptorProxy(adaptee.toProxy());
  }
  
  public Iterable<RiskCheckTarget> getCheckTargets() {
    Collection<RiskCheckTarget> _xblockexpression = null;
    {
      final TSKRoutineTaskGenerator generator = this.adaptee.getGenerator();
      Collection<RiskCheckTarget> _switchResult = null;
      boolean _matched = false;
      if (!_matched) {
        if (generator instanceof RiskCheckGenerator) {
          final RiskCheckGenerator _riskCheckGenerator = (RiskCheckGenerator)generator;
          _matched=true;
          Collection<RiskCheckTarget> _checkTargets = _riskCheckGenerator.getCheckTargets();
          _switchResult = _checkTargets;
        }
      }
      if (!_matched) {
        ArrayList<RiskCheckTarget> _newArrayList = CollectionLiterals.<RiskCheckTarget>newArrayList();
        _switchResult = _newArrayList;
      }
      _xblockexpression = (_switchResult);
    }
    return _xblockexpression;
  }
}
